Skip to content

Health text improvements - #2

Open
KharchenkoDmitriy wants to merge 3 commits into
NeeRgY:masterfrom
KharchenkoDmitriy:features/dynamic-health-deficit-text-colour
Open

Health text improvements#2
KharchenkoDmitriy wants to merge 3 commits into
NeeRgY:masterfrom
KharchenkoDmitriy:features/dynamic-health-deficit-text-colour

Conversation

@KharchenkoDmitriy

Copy link
Copy Markdown

Summary

Three related improvements to the health text indicator (Health 1/2, Shields, Heal Absorbs):

  • Color-by-health gradient — each segment can now blend its color from red (low health) → yellow → its normal base color as health rises, ElvUI-style, instead of always showing a static baked-in color.
  • 2-decimal option for abbreviated numbers — abbreviated values (e.g. 12.3K) can now be shown with 2 decimals (12.34K) instead of 1, as an explicit per-segment dropdown option alongside the existing 1-decimal format. The original 1-decimal formats are unchanged, so existing layouts render identically.
  • Hide deficit text at 0 — Deficit / Deficit (Short) / Deficit % no longer show -0/0% once a unit is topped off. This reuses a hideIfEmptyOrFull field that already existed in the saved layout schema but was never actually wired up for health text. New layouts default to hiding it; existing layouts get a checkbox to opt in.

Changes by commit

Add ElvUI-style health-by-color gradient text option

  • New F.GetHealthTextColor helper in Utils.lua (wraps the existing F.ColorGradient).
  • colorByHealth toggle added to health1/health2/shields/healAbsorbs segment config, with a checkbox next to each segment's color picker in the indicator settings UI.
  • Colors are computed live per health-text update rather than baked into the format pattern; secret (combat-log-restricted) values fall back to the static base color since a live percent isn't available at that layer.

Add 2-decimal option for abbreviated health text

  • F.FormatNumber now takes an optional decimals argument (default 1, matching prior behavior).
  • New *_short2 format variants (health/deficit/effective/shields/heal-absorbs) selectable from each segment's format dropdown, labeled with a (2 Decimals) tag.

Hide deficit text at 0, with a toggle to always show it

  • Deficit-family formatters accept a hideIfZero flag and return an empty string when the computed deficit is 0.
  • Wires up the existing hideIfEmptyOrFull field per health1/health2 segment (previously present in the saved-variables schema but unused everywhere except a no-op stub on Power Text).
  • New checkbox in the health text settings UI; new layouts default to hidden, existing layouts keep their current (visible) behavior until toggled.

Test plan

  • Enable Health Text on a unit frame, set Health 1/2 to a Deficit format, and confirm the text disappears at full health and reappears when damaged.
  • Toggle the new "hide if empty/full" checkbox off and confirm -0/0% shows again at full health.
  • Enable "color by health" on a segment and confirm the text color shifts red → yellow → base color as health drops/rises, including with Class Color and Custom Color base colors.
  • Select a (2 Decimals) format option and confirm the abbreviated number shows 2 decimal places; confirm the corresponding 1-decimal option is unchanged.
  • Sanity check on a Classic flavor (Cata/Wrath/Mists/TBC/Vanilla defaults were updated too).

Adds a colorByHealth toggle for the health1/health2/shields/healAbsorbs
health text segments: when enabled, the segment's color blends from red
(low health) to yellow to its normal base color as health rises, instead
of a static baked-in color.
F.FormatNumber now takes an optional decimals argument (defaults to 1,
matching prior behavior for backward compatibility). Adds "_short2"
format entries and matching dropdown options for health/deficit/
effective/shields/heal-absorb text, so users can opt into 2-decimal
precision (e.g. 12.34K) per segment instead of the default 1 decimal.
The deficit/deficit_short/deficit_short2/deficit_percent formats now
suppress their output once a unit is topped off, instead of always
showing "-0"/"0%". Controlled per-segment by the segment's existing
(previously unused) hideIfEmptyOrFull setting, now with a real checkbox
in the health text settings. Defaults to hidden for new layouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant